//
//  YHGROtherMain.m
//  test
//
//  Created by 李彦宏 on 2018/3/10.
//  Copyright © 2018年 朱圳. All rights reserved.
//

#import "YHGROtherMain.h"
#import "YHGROtherNodoVC.h"//待操作
#import "YHGROtherdown.h"//已同意
#import "YHGRRefusedVC.h"//已拒绝
#import "YHGROtherPayVC.h"//已支付

@interface YHGROtherMain ()<UITableViewDelegate,UITableViewDataSource>
@property (nonatomic, strong) UITableView *tableView;
@property (nonatomic, strong) NSMutableArray *contarry;
@end

@implementation YHGROtherMain
//UItableView初始化
- (void)setupTable
{
    UITableView *tableView=[[UITableView alloc] initWithFrame:self.view.bounds style:UITableViewStylePlain];
    //隐藏组距导航栏的间距
    tableView.tableHeaderView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 0, CGFLOAT_MIN)];
    tableView.backgroundColor=[UIColor whiteColor];
    tableView.showsHorizontalScrollIndicator=NO;
    tableView.showsVerticalScrollIndicator=NO;
    tableView.dataSource=self;
    tableView.delegate=self;
 tableView.separatorStyle=UITableViewCellSeparatorStyleNone;
    [self.view addSubview:tableView];
    self.tableView=tableView;
    
 }
- (void)viewDidLoad {
    [super viewDidLoad];
    _contarry=[NSMutableArray arrayWithObjects:@"待操作", @"已同意",@"已拒绝",@"已支付",nil];
    
     [self.view setBackgroundColor:[UIColor whiteColor]];
    [self setupTable];
}
#pragma -mark -----------------------------tableview datasource and delegate---------------------------------
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
    return 1;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return _contarry.count;
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    return 45;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    // 1.创建cell
    static NSString *ID = @"cell";
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:ID];
    if (cell == nil) {
        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:ID];
        cell.accessoryType=UITableViewCellAccessoryDisclosureIndicator;
    }
    // 2.设置cell的数据
    cell.textLabel.text = _contarry[indexPath.row];
    
    return cell;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    [self.tableView deselectRowAtIndexPath:indexPath animated:YES];

    switch (indexPath.row) {
        case 0:
        {
        YHGROtherNodoVC *vc0=[[YHGROtherNodoVC alloc]init];
            vc0.title=@"待操作";
            vc0.view.backgroundColor=[UIColor whiteColor];
            [self.navigationController pushViewController:vc0 animated:YES];
            break;
        }
            
        case 1:{
            YHGROtherdown *vc0=[[YHGROtherdown alloc]init];
            vc0.title=@"待操作";
            vc0.view.backgroundColor=[UIColor whiteColor];
            [self.navigationController pushViewController:vc0 animated:YES];
            break;
        }
        case 2:
        {
            YHGRRefusedVC *vc0=[[YHGRRefusedVC alloc]init];
            vc0.title=@"待操作";
            vc0.view.backgroundColor=[UIColor whiteColor];
            [self.navigationController pushViewController:vc0 animated:YES];
            
            break;
        }
           
        case 3:
        {
            YHGROtherPayVC *vc0=[[YHGROtherPayVC alloc]init];
            vc0.title=@"待操作";
            vc0.view.backgroundColor=[UIColor whiteColor];
            [self.navigationController pushViewController:vc0 animated:YES];
            
            break;
        }
           
        default:
            break;
    }
}

- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
{
    return 1;
}


- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section
{
    return 1;
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
